package com.oa.web.intercept;

import com.oa.bean.User;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class DailyLoginIntercepter extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		User user = (User) ServletActionContext.getRequest().getSession().getAttribute("userInfo");
		if (user == null) {
			return "login";
		} else {
//			System.out.println(user.getUsername());
			return invocation.invoke();
		}

	}

}
